<template>
	<view class="body">
		<view class="title-box" @click="back()">
			<!-- <view class="title">荷式拍卖列表</view> -->
			<text class="iconfont icon-left"></text>
		</view>
		<view class="item">
			<view class="image">
				<image style="width: 100%;height: 100%;border-radius: 100%;" :src="global+userInfo.icon" mode="">
				</image>
			</view>
			<view class="box_item">
				<view class="title" style="display: flex;">姓名</view>
				<view class="in-ys">{{userInfo.username}}</view>
			</view>
			<view class="box_item">
				<view class="title" style="display: flex;">邮箱</view>
				<view class="in-ys">{{userInfo.email}}</view>
			</view>
			<view class="box_item">
				<view class="title" style="display: flex;">电话</view>
				<view class="in-ys">{{userInfo.phone}}</view>
			</view>
			<view class="box_item">
				<view class="title" style="display: flex;">入住原因</view>
				<view class="in-ys">{{userInfo.reason}}</view>
			</view>

		</view>
		<view class="bottom">
			<view class="button" @click="success">审核通过</view>
			<view class="button" @click="refuse">审核拒绝</view>
			<view class="button" @click="back">返回</view>
		</view>

	</view>
</template>

<script>
	import apis from '@/api/index.js'
	import G from '@/config/global.js'
	import {
		requestApi,
		uphttp
	} from '@/utils/request.js'
	// 导入公共组件方法
	import common from '@/common/js/common.js';
	export default {
		data() {
			return {
				userInfo: {

				},
				infoId: {

				}
			}
		},
		onLoad(e) {
			this.infoId.userId = e.id;
			this.info();
		},
		methods: {
			info() {
				requestApi(apis.user.info, this.infoId, 'post').then(res => {
					this.userInfo = res.data;
				})
			},
			success() {
				this.userInfo.status = 2;
				requestApi(apis.user.apply, this.userInfo, 'post').then(res => {
					if (res.code == 200) {
						uni.showToast({
							icon: "success",
							title: "审核成功"
						})
					}
				})
			},
			refuse() {
				this.userInfo.status = 3;
				requestApi(apis.user.apply, this.userInfo, 'post').then(res => {
					if (res.code == 200) {
						uni.showToast({
							icon: "success",
							title: "审核成功"
						})
					}
				})
			},
			back() {
				uni.navigateBack({
					delta: 1
				})
			}
		}
	}
</script>

<style>
	.body {
		padding: 0 32rpx;
		min-height: 100vh;
		background-image: url('../../static/bgc.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
	}

	.item {
		position: absolute;
		width: 100%;
	}

	.image {
		position: relative;
		left: 50%;
		transform: translateX(-50%);
		width: 132rpx;
		height: 132rpx;
		border-radius: 100%;
	}

	.title {
		width: 160rpx;
		margin-right: 30rpx;
		font-family: 'PingFang SC';
		font-style: normal;
		font-weight: 400;
		font-size: 28rpx;
		line-height: 40rpx;
		color: rgba(51, 51, 51, 0.4);
		text-align: left;
	}

	.in-ys {
		width: 80%;
		border-radius: 8rpx;
		/* background: #F6F6F6; */
	}

	.box_item {
		display: flex;
		padding: 24rpx 0px;
		align-items: center;
		position: relative;
		/* justify-content: space-between; */
		border-bottom: 1px solid #fafafa;
	}

	.button {

		width: 40%;

		color: #fff;
		background-color: #07b1ff;
		padding: 32rpx;
		border-radius: 64rpx;
		text-align: center;
	}

	.bottom {
		position: absolute;
		bottom: 40rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 100%;
		display: flex;
		justify-content: space-between;
	}
</style>